﻿USE SuperSurvey
GO


CREATE PROC sp_CreateAccount
	@username nvarchar(100),
	@password nvarchar(100),
	@fullname nvarchar(100),
	@birthdate smalldatetime,
	@phone nvarchar(100),
	@email nvarchar(100),
	@address nvarchar(100),
	@country nvarchar(100)
AS
BEGIN
	INSERT INTO UserLogin(Username,[Password]) VALUES (@username,@password)
	INSERT INTO UserInformation VALUES (@username,@fullname,@birthdate,@phone,@email,@address,@country)
	
END
GO


CREATE PROC sp_GetFriendList
@userid nvarchar(100)
AS
BEGIN
	SELECT a.FriendID AS 'Friends List', b.Status
	FROM Friend AS a INNER JOIN UserLogin AS b ON a.FriendID = b.Username
	WHERE a.UserID = @userid
END
GO


exec sp_CreateAccount 'anhntv','123456','Nguyen Thi Van Anh','1994-08-28','01234567899','anhntv_b01499@fpt.aptech.ac.vn','Ha Noi','Viet Nam'
select*from UserInformation
select*from UserLogin


